# -*- coding: utf-8 -*-
"""
    :author: FanZhong (范钟)
    :copyright: © 2018 FanZhong <coder.fan@qq.com>
    :license: MIT, see LICENSE for more details.
"""

# from flask_bootstrap import Bootstrap
from flask_ckeditor import CKEditor
from flask_login import LoginManager
from flask_mail import Mail
from flask_moment import Moment
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import CSRFProtect

# bootstrap = Bootstrap()
db = SQLAlchemy()
login_manager = LoginManager()


csrf = CSRFProtect()
ckeditor = CKEditor()
mail = Mail()
moment = Moment()


@login_manager.user_loader
def load_user(user_id):
    from fblog.models import Admin
    user = Admin.query.get(int(user_id))
    return user


login_manager.login_view = 'auth.login'
login_manager.login_message = '请登陆之后再执行操作'
login_manager.login_message_category = 'warning'

